Skip to content

fix(kimi-web): improve mobile safe-area handling#1459

Open
wbxl2000 wants to merge 1 commit into
mainfrom
fix/mobile-safe-area
Open

fix(kimi-web): improve mobile safe-area handling#1459
wbxl2000 wants to merge 1 commit into
mainfrom
fix/mobile-safe-area

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No tracking issue. Follows up on a mobile safe-area review for kimi-web.

Problem

Mobile kimi-web handled safe-area insets in scattered component-local ways. Keyboard open could leave the composer above the visual viewport on browsers that do not shrink the layout viewport. Landscape added inline insets twice. The mobile top bar ignored the top inset in PWA mode. Toasts were anchored to a hard-coded dock height that breaks when the composer grows to multiple lines.

What changed

  • Added interactive-widget=resizes-content to the viewport meta tag so the layout viewport shrinks with the on-screen keyboard.
  • Centralised safe-area insets as --safe-top, --safe-right, --safe-bottom, and --safe-left in :root, and replaced component-local env(safe-area-inset-*) usages.
  • Added top and landscape safe-area handling to MobileTopBar.
  • Moved mobile inline insets into ChatDock inline variables so the inset is applied once instead of at both dock and composer layers.
  • Measured the chat dock height with ResizeObserver and exposed it as --dock-h.
  • Re-anchored WarningToasts above the dock using --dock-h instead of a hard-coded 76px.
  • Added a visualViewport resize listener in ConversationPane to keep following the latest message on browsers without full interactive-widget support.
  • Standardised bottom minimum gutters across composer and bottom sheets.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • Ran pnpm --filter @moonshot-ai/kimi-web typecheck.
  • Ran oxlint on the changed files. Existing unrelated warnings only.
  • Ran gen-changesets skill, or this PR needs no changeset.

@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2e1cceb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2e1cceb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2e1cceb

commit: 2e1cceb

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e1cceb2c7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

bottom: calc(76px + env(safe-area-inset-bottom));
/* Sit just above the chat dock; --dock-h already includes the dock's own
safe-area padding, so no extra safe-bottom term is needed. */
bottom: calc(var(--dock-h, 76px) + 8px);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a real fallback when the dock height is unset

Because style.css initializes --dock-h to 0px, the var(--dock-h, 76px) fallback here never selects 76px. On mobile states where ChatDock has not mounted yet or is not rendered (for example auth/empty-session warning toasts), the stack is placed only 8px above the viewport bottom, losing the previous safe-area/home-indicator clearance and potentially covering the toast actions. Consider leaving --dock-h unset until measured or using an explicit max()/safe-bottom fallback.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant